﻿using System.Linq;
using AspectsSample.Contracts;
using AspectsSample.DataModels;
using AspectsSample.Helpers;

namespace AspectsSample.Repositories
{
    internal class LanguageRepository : RepositoryBase, ILanguageRepository
    {
        public LanguageDataModel GetLanguage(int id)
        {
            ReadXmlFile("Language.xml");
            LanguageConfigDataModel langs = null;
            SerialisationHelper.Deserialise(XmlDoc, ref langs);
            return langs.Languages.AsParallel().SingleOrDefault(l => l.Id == id);
        }
    }
}
